var app = getApp()
Page({
  data: {
    winWidth: 0,
    winHeight: 0,
    // tab切换  
    currentTab: 0,
    btnLeftClass: 'btnLeftClass',
    btnRightClass: 'btnRightClass',
   
  },
  onLoad: function () {
    var that = this;
    /** 
     * 获取系统信息 
     */
    wx.getSystemInfo({
      success: function (res) {
        that.setData({
          winWidth: res.windowWidth,
          winHeight: res.windowHeight
        });
      }
    });
  },
  /** 
     * 滑动切换tab 
     */
  bindChange: function (e) {
    var that = this;
    that.setData({ currentTab: e.detail.current });
    if (this.data.currentTab == 1) {
      that.setData({
        btnLeftClass: 'btnRightClass',
        btnRightClass: 'btnLeftClass',
      });
    } else {
      that.setData({
        btnLeftClass: ' btnLeftClass',
        btnRightClass: 'btnRightClass',
      });
    }
    
  },
  /** 
   * 点击tab切换 
   */
  swichNav: function (e) {
    var that = this;
    if (this.data.currentTab === e.target.dataset.current) {
      
      this.setData({
        isNone: "none",
      });
      return false;
    } else {
      that.setData({
        currentTab: e.target.dataset.current,
        btnLeftClass: 'btnRightClass' ,
        btnRightClass: 'btnLeftClass',
      });
    };
    if (this.data.currentTab == 1){
      that.setData({
        btnLeftClass: 'btnRightClass',
        btnRightClass: 'btnLeftClass',
      });
    }else{
      that.setData({
        btnLeftClass: ' btnLeftClass',
        btnRightClass: 'btnRightClass',
      });
    }
  },
  
})